var data = "{\n  \"campusId\" : \"267\",\n  \"customerName\" : \"姚旭\",\n  \"customerId\" : \"2725229\",\n  \"customerPhone\" : \"15188583872\"\n}";

data = {
    campusId: "267",
    customerName: "姚旭",
    customerId: "2725229",
    customerPhone: "15188583872"
}

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function() {
  if(this.readyState === 4) {
    console.log(this.responseText);
  }
});

xhr.open("POST", "http://gx-app-server.dcrym.com/dcxy/api/gx/devices/G4000744/beginning");
xhr.setRequestHeader("clientSource", " ");
xhr.setRequestHeader("Content-Length", "116");
xhr.setRequestHeader("reqSource", " ");
xhr.setRequestHeader("Content-Type", " application/json");
// xhr.setRequestHeader("token", "customer:app:login:token:712512b227f735158c42dfb1dec6661d");
// xhr.setRequestHeader("Cookie", "JSESSIONID=5CCA73FE640230565D6BB04570655A05");

// xhr.send(data);
xhr.send(JSON.stringify(data));